package org.lisen.printhtmlstarter.config;

import org.lisen.printhtmlstarter.service.PrintHtmlService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author laughing
 * @date 2020/9/26
 * @site https://www.lisen.org
 */
@Configuration
@EnableConfigurationProperties(BlogPropertes.class)
@ConditionalOnClass(PrintHtmlService.class)
public class AutoConfiguration {

    @Resource
    BlogPropertes blogPropertes;

    @Bean
    @ConditionalOnClass
    public PrintHtmlService printHtmlService(){
        PrintHtmlService printHtmlService = new PrintHtmlService();
        printHtmlService.setUrl(blogPropertes.getUrl());
        return printHtmlService;
    }

}
